<template>
	<div class="factory-examine table-theme">
		<head-title title="审核--操作审核"></head-title>
		<el-card>
			<div class="top-menu">
				<div class="menu-left"></div>
				<div class="menu-right">
					<refresh-button @refresh="refreshPage"></refresh-button>
					<search-view :option="searchOption" @value="goSearch" @clear="refreshPage" ></search-view>
				</div>
			</div>
			<p class="data-number">总数据数：{{total}}</p>
			<el-table :data="fabricList" class="factory-table">
				<el-table-column label="序号" align="center" prop="id"></el-table-column>
				<el-table-column label="工厂序号" align="center" prop="factory_id"></el-table-column>
				<el-table-column label="用户序号" align="center" prop="user_id"></el-table-column>
				<el-table-column label="工厂编号" align="center">
					{{factory_sn}}
				</el-table-column>
				<el-table-column label="商品名称" align="center" prop="goods_name" width="300"></el-table-column>
				<el-table-column label="平台款号" align="center" prop="goods_sn"></el-table-column>
				<el-table-column label="商品图片" align="center" width="80">
					<template slot-scope="scope">
						<ImgPopover :src="scope.row.image"></ImgPopover>
					</template>
				</el-table-column>
				<el-table-column label="类型" align="center" prop="type_name"></el-table-column>
				<el-table-column label="商品编号" align="center" prop="type_id"></el-table-column>
				<el-table-column label="状态" align="center" prop="status_name"></el-table-column>
				<el-table-column label="拒绝原因" align="center" prop="reason"></el-table-column>
				<el-table-column label="审核人" align="center" prop="examine_user_id"></el-table-column>
				<el-table-column label="审核时间" align="center" prop="examine_time"></el-table-column>
				<el-table-column label="申请时间" align="center" prop="add_time"></el-table-column>
				<el-table-column label="操作" align="center">
					<template slot-scope="scope">
						<el-button type="primary" size="mini" @click="edit" v-if="scope.row.status_name == '审核不通过'">编辑</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div class="pages"><el-pagination background layout="prev, pager, next, jumper" :total="total" @current-change="init" :current-page="page"></el-pagination></div>
		</el-card>

	</div>
</template>

<script>
import ImgPopover from '@/components/ImgPopover';
export default {
	components: {
		ImgPopover
	},
	data() {
		return {
			factory_sn: localStorage.getItem('factory_sn'),
			factory_id: localStorage.getItem('factory_id'),
			fabricList: [], // 用户列表
			total: 0,
			totalData: 0, 
			page: 0,
			searchOption: [
				{
				value: 0,
				label: "平台款号",
				}
			],
			classSelect: 0,
			selectContent: "",
		};
	},
	methods: {
		// 初始化列表
		init(e) {
			this.page = e;
			let data = {
				page: e - 1 ? e - 1 : 0,
				limit: 10,
				factory_id: this.factory_id
			};
			if(this.selectContent != ''){
				data.goods_sn = this.selectContent;
			}
			this.$http(this.$ApiList.FactoryExamineList, data).then(res => {
				this.fabricList = res.datas.list;
				this.total = res.datas.count;
			});
		},
		goSearch(classSelect, selectContent) {
			this.classSelect = classSelect;
			this.selectContent = selectContent;
			this.init();
		},
		edit(){
			
		},
		refreshPage() {
			this.selectContent = ''
			this.init()
		}
	},
	created() {
		this.init();
	}
};
</script>
<style lang="scss" scoped>
.user-info .el-avatar {
	display: block;
	margin: 0 auto;
}
.info-exhibition {
	margin-top: 20px;
}
.info-exhibition p {
	text-align: center;
	line-height: 30px;
	margin-bottom: 0;
}
</style>
